# -*- encoding: utf-8 -*-


class Graph(object):
    def __init__(self, vertex):
        self.vertex = vertex
        self.graph = [[0] * vertex for i in range(vertex)]

    def add_edge(self, x, y):
        self.graph[x - 1][y - 1] = 1
        self.graph[y - 1][x - 1] = 1

    def show(self):
        for x in self.graph:
            for y in x:
                print(y, end=' ')
            print(' ')


if __name__ == '__main__':
    g = Graph(5)
    g.add_edge(1, 4)
    g.add_edge(4, 2)
    g.add_edge(4, 5)
    g.add_edge(2, 5)
    g.add_edge(5, 3)
    g.show()
